package com.zretc.kscxmz.services.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.zretc.kscxmz.entity.tongxunlu.Sex;
import com.zretc.kscxmz.entity.tongxunlu.TongXun;
import com.zretc.kscxmz.mappers.TongXunluMapper;
import com.zretc.kscxmz.services.TongXunluService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class TongXunluImpl implements TongXunluService {

    @Autowired
        private TongXunluMapper tongXunluMapper;

    @Override
    public Sex findAlist(Sex ziMu) {
        Sex alist = tongXunluMapper.findAlist(ziMu);
        return alist;
    }

    @Override
    public PageInfo<TongXun> find(String xing,int pageNum,int pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        List<TongXun> tongXuns = tongXunluMapper.find(xing);
        PageInfo<TongXun> tongXunPageInfo = new PageInfo<>(tongXuns);
        return tongXunPageInfo;
    }

    @Override
    public PageInfo<TongXun> list(int pageNum,int pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        List<TongXun> list = tongXunluMapper.list();
        PageInfo<TongXun> tongXunPageInfo = new PageInfo<>(list);
        return tongXunPageInfo;
    }

    @Override
    public PageInfo<TongXun> allfind(TongXun tongXun,int pageNum,int pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        List<TongXun> allfind = tongXunluMapper.allfind(tongXun);
        PageInfo<TongXun> tongXunPageInfo = new PageInfo<>(allfind);
        return tongXunPageInfo;
    }
}
